package com.example.fitapp.activity.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.fitapp.activity.R;
import com.example.fitapp.activity.activity.ReadlyPushImage;

import java.util.List;

public class ReadyRecycleAdapter extends RecyclerView.Adapter<ReadyRecycleAdapter.ViewHolder> {

    private List<ReadlyPushImage> mReadlyPushImages;

    public class ViewHolder extends RecyclerView.ViewHolder {
        View ImageDetailView;
        ImageView image;
        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            ImageDetailView = itemView;
            image = (ImageView) itemView.findViewById(R.id.ready_img);
        }
    }

    public ReadyRecycleAdapter(List<ReadlyPushImage> readlyList) {
        mReadlyPushImages = readlyList;
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.ready_push_image_item,parent,false);
        ViewHolder holder = new ViewHolder(view);
        holder.ImageDetailView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        return holder;
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
        ReadlyPushImage readlyPushImage = mReadlyPushImages.get(position);
        holder.image.setImageBitmap(readlyPushImage.getImageUrl());
    }

    @Override
    public int getItemCount() {
        return mReadlyPushImages.size();
    }


}
